package fictional.GUI;

import java.awt.Dimension;
import java.awt.event.WindowAdapter;
import javax.swing.ImageIcon;

/**
 * Create an About popup window.
 */
@SuppressWarnings("serial")
public class AboutPopup extends javax.swing.JFrame
{
	GUI gui;
	
    public AboutPopup(final GUI gui)
    {
		this.gui = gui;
		this.setTitle("About FicBook");
		this.setSize(new Dimension(500, 130));
		gui.setEnabled(false);
		gui.setIsEnabled(false);
		this.setIconImage(new ImageIcon(getClass().getResource("resources/windowIcon.gif")).getImage());
		
        this.addWindowListener(new WindowAdapter() {
        	public void windowClosing(java.awt.event.WindowEvent e) {
                gui.setIsEnabled(true);
                gui.setEnabled(true);
        	}
        });

        initComponents();
    }

    private void initComponents() {
        java.awt.GridBagConstraints gridBagConstraints;

        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();

        getContentPane().setLayout(new java.awt.GridBagLayout());

        jLabel2.setFont(new java.awt.Font("Tahoma", 1, 12));
        jLabel2.setText("FicBook");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(20, 20, 10, 10);
        getContentPane().add(jLabel2, gridBagConstraints);

        jLabel3.setText("(C) 2011");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(10, 20, 0, 10);
        getContentPane().add(jLabel3, gridBagConstraints);

        jLabel4.setText("A Social Network for fictional characters, across all realms, worlds and galaxies.");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(10, 20, 0, 10);
        getContentPane().add(jLabel4, gridBagConstraints);

        jLabel5.setText("Created by Maoz Gelbart, Alon Nachshon, Nir Wallenstein & Avia Amitay.");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 4;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(20, 20, 0, 10);
        getContentPane().add(jLabel5, gridBagConstraints);

        jButton1.setText("Close");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 5;
        gridBagConstraints.insets = new java.awt.Insets(15, 0, 0, 0);
        getContentPane().add(jButton1, gridBagConstraints);
        
        jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
            	closeButtonMouseClicked();
            }
        });

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/fictional/GUI/resources/aboutImage.gif"))); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.gridheight = 6;
        getContentPane().add(jLabel1, gridBagConstraints);

        pack();
    }
    
	private void closeButtonMouseClicked()
	{
		gui.setEnabled(true);
		gui.setIsEnabled(true);
		this.setVisible(false);
		this.dispose();
	}

    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
}